package household.util;

import java.io.Serializable;
import java.util.List;

import org.springframework.web.servlet.ModelAndView;

public class IModelAndView extends ModelAndView implements Serializable{

	private static final long serialVersionUID = 1L;

	public IModelAndView(String string,int id) {
		super(string);
		int code = 0;
		if(id <= 0){
			code = 1;
		}
		this.addObject("code", code);
		this.addObject("status", true);
	}
	public IModelAndView(String string,boolean status) {
		super(string);
		int code = 0;
		if(!status){
			code = 1;
		}
		this.addObject("code", code);
		this.addObject("status", true);
	}
	public IModelAndView(String string,Object status) {
		super(string);
		int code = 0;
		if(status == null){
			code = 1;
		}else{
			this.addObject("rows", status);
		}
		this.addObject("code", code);
		this.addObject("status", true);
	}
	public IModelAndView(String string,List<Object> status) {
		super(string);
		int code = 0;
		if(status == null){
			code = 1;
		}else if(status.size() == 0){
			code = 1;			
		}else{
			this.addObject("rows", status);
		}
		this.addObject("code", code);
		this.addObject("status", true);
	}

}
